﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using OrderTest;
namespace FormTest
{
    public partial class Form2 : Form
    {
        List<OrderDetails> details = new List<OrderDetails>();
        string orderID;
        string client;
        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if(textBox1.Text.Length != 0 && textBox2.Text.Length != 0 && details.Count != 0)
            {
                orderID = textBox1.Text;
                client = textBox2.Text;
                pubClass.service.addOrder(orderID, client, details);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string productName;
            int amount;
            double price;
            if(textBox3.Text.Length != 0 && textBox4.Text.Length != 0 && textBox5.Text.Length != 0)
            {
                productName = textBox3.Text;
                amount = Convert.ToInt32(textBox4.Text);
                price = Convert.ToDouble(textBox5.Text);
                OrderDetails detail = new OrderDetails(price, amount, productName);
                details.Add(detail);
            }
        }
    }
}
